﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Bll;
public partial class Resumecfg : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            thispower();

        }
        BindGrid();
    }
    private void thispower()
    {
        if (Session["usergroup"] != null && Session["usergroup"] != "")
        {
            if (Session["usergroup"] != "admin")
            {
                Response.Write("<script>alert(\"你无权查看！\");history.back();</script>");
            }
        }
        else
        {
            Response.Write("<script>alert(\"你无权查看！\");history.back();</script>");
        }
    }
    protected void lbtn1_Click(object sender, EventArgs e)
    {
        BindGrid();
    }
    protected void GridView1_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        GridView1.PageIndex = e.NewPageIndex;
        BindGrid();
    }
    private void BindGrid()
    {
        StudentBll bll = new StudentBll();
        string keyword = TextBox1.Text.Trim();
        GridView1.DataSource = bll.getStudents(keyword,1);
        GridView1.DataBind();
    }
    protected void lbtn3_Click(object sender, EventArgs e)
    {
        string sno = ((LinkButton)sender).CommandArgument;
        ResumeBll bll = new ResumeBll();
        int index = GridView1.PageIndex;
        if (bll.ClearResume(sno) > 0)
        {
            ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>alert('操作成功');</script>");
        }
        else
        {
            ClientScript.RegisterStartupScript(ClientScript.GetType(), "myscript", "<script>alert('操作失败');</script>");
        }
        BindGrid();
        GridView1.PageIndex = index;
    }
}